import request from "../utils/request.js";

export function fetchProducts() {
  return request({
    url: "/content/products/",
    method: "GET",
  });
}

export function addProduct(data) {
  return request({
    url: "/content/products/",
    method: "POST",
    headers: {
      "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    data,
  });
}

export function updateProduct(productId, data) {
  return request({
    url: `/content/products/${productId}/`,
    method: "PUT",
    headers: {
      "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    data,
  });
}

export function deleteProduct(productId) {
  return request({
    url: `/content/products/${productId}/`,
    method: "DELETE",
  });
}
